<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<a href="01-BOM之Location.html">跳转到第一个页面</a>
<button type="button" onclick="back()">返回</button>
<button type="button" onclick="forward()">前进</button>
<button type="button" onclick="doGo()">去到指定页面</button>
<input type="number" id="i1">
<script>
    function back() {
        history.back();
    }

    function forward() {
        history.forward()
    }

    function doGo() {
        //valueAsNumber
        let i1 = document.querySelector("#i1").value;
        history.go(parseInt(i1));
    }
</script>
</body>
</html>